import { getArticleById } from "../../service/article"; export default defineWrappedResponseHandler(async (event) => { const idParam = getRouterParam(event, "id"); if (!idParam) return R.throwError(400, "缺少文章 ID", null); const id = parseInt(idParam); if (isNaN(id)) return R.throwError(400, "文章 ID 格式不正确", null); const article = await getArticleById(id); if (!article) return R.throwError(404, "文章不存在", null); return R.success(article); });